new Vue({
    el:"#box",
    data:{
        text:"",
        currentIndex:0,
        currentIndex1:0,
        arr:["综合排序","距离最近","销量最高","筛选"],
        list:[
            {name:"一点点",pic:"./img/1.png",point:"☆4.3",price:"起送￥20",time:"47分钟",length:"3.3Km",sum:"3.3"},
            {name:"麦当劳",pic:"./img/2.png",point:"☆4.6",price:"起送￥0",time:"28分钟",length:"2.3Km",sum:"2.3"},
            {name:"蜜雪冰城",pic:"./img/3.png",point:"☆4.8",price:"起送￥15",time:"32分钟",length:"1.4Km",sum:"1.4"},
            {name:"故事里的炸鸡",pic:"./img/4.png",point:"☆5.0",price:"起送￥1",time:"30分钟",length:"335m",sum:"0.335"},

            ],
        footlist:[
                {pic:"",name:"首页"},
                {pic:"",name:"订单"},
                {pic:"",name:"我的"}

                 ]
        
    },
    methods:{
        handle(index){
            this.currentIndex = index;
            console.log(index);
            if(index==1){
                this.list.sort(
                    (a,b)=>{
                        return(a.sum/1<b.sum/1?-1:(a.sum/1>b.sum/1)?1:0)
                    }
                )
                
                
            }else if(index==2){
                this.list.sort(
                    (a,b)=>{
                        return(a.sum/1>b.sum/1?-1:(a.sum/1<b.sum/1)?1:0)
                    }
                )
            } 

        },
        handleClick(index){
            this.currentIndex1 = index;
        }


    }
})